<template>
  <ul>
    <li
      v-for="(i, index) in arr"
      :class="{ active: index == st }"
      @mousemove="fn(index)"
    >
      {{ i }}
    </li>
  </ul>
</template>
<script>
export default {
  data() {
    return {
      arr: ["美食", "新闻", "天气", "旅游"],
      bool: true,
      st: 0,
    };
  },
  methods: {
    fn(index) {
      console.log("in");
      this.st = index;
    },
  },
};
</script>
<style lang="css">
ul {
  width: 300px;
  height: 100px;
}

li {
  width: 50px;
  height: 50px;
  float: left;
  background: pink;
  text-align: center;
  line-height: 50px;
  margin-left: 10px;
  list-style: none;
}

.active {
  background: red;
}
</style>
